// BonusBingoSubGame.h: interface for the BonusBingoSubGame class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(__BONUSBINGOSUBGAME_H__)
#define __BONUSBINGOSUBGAME_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "lib.h"
#include "WeightedOutcomes.h"
#include "BonusBingoSql.h"  //Now, for GameID.  Might be able to move - TODO
#include "SubGameData.h"

class BonusBingoSubGame
{
protected:
    GameID   m_gid;
    SubGame* m_subGame;

    static const int32 JokerDieValue;

    static WeightedOutcomes s_SubGameRoundsOutcomes;

    static void LoadOutcomes();

    void   incrementCurrentRoll();

    void   updateCreditsForLastRoll( int32 credits );
    void   updateTotalCredits( int32 credits );
    int32  creditValue( int32 diceValue )  const;

    enum RoundCountProbabilities
    {
        THREE_GAMES =   1000,
        TWO_GAMES   =   THREE_GAMES  + 3000,
        ONE_GAME    =   TWO_GAMES    + 6000,
        PROBABILITY_BASE = ONE_GAME
    };

public:
    static  const   int32   NumberOfDice;
    static  const   int32   SubgameWinThreshold;

	BonusBingoSubGame(const String& pid, bool8 forMoney);
	virtual ~BonusBingoSubGame();

    SubGame& getSubGameData() const;

    void    setGameID( const GameID ID );
    const   GameID& getGameID()    const;

    void    incrementJokerBalls(int32 lastBet);

    void    start();
    void    selectNumberOfRolls();
    void    rollDice();
    void    reset();

    int32   getCurrentJokerBallCount() const;
    int32   getCurrentDieValue( int32 dieIndex ) const;

    bool8   started()  const;
    bool8   finished() const;

    int32   getAverageBetMultiplier() const;
    int32   getCurrentRoll()  const;
    int32   getCreditsForLastRoll() const;
    int32   getTotalCredits() const;
    int32   getTotalRolls()   const;    
};

#endif // !defined(__BONUSBINGOSUBGAME_H__)
